<template>
	<view class="content" :style="app_bg">
		<view class="topTitle" :style="'top:'+zhuangtai+'px'">
			<image class="back" @click="backClick" :src="publicimg.btn_back" mode=""></image>
			<view class="" style="font-size: 32rpx;">
				明细
			</view>
		</view>
		<view class="listindex font34" :style="'margin-top:'+(zhuangtai+52)+'px;background:'+publicTextColor.app_theme_color+';color:'+publicTextColor.font_1st_color+';'">
			<view class="item">类型</view>
			<view class="item">时间</view>
			<view class="item">数量</view>
		</view>
		<view class="listitem font28" :style="'background:'+publicTextColor.app_theme_color+';color:'+publicTextColor.font_4th_color+';'">
			<view class="item" v-for="(item, index) in moneyList" :key="index" :style="app_border_bottom">
				<text>{{item.type_name}}</text>
				<text>{{item.create_time}}</text>
				<text v-if="item.op == 1">+{{item.amount}}</text>
				<text v-if="item.op == 2">-{{item.amount}}</text>
			</view>
		</view>
	</view>
</template>

<script>
	var util = require('@/js/util.js')
	export default {
		data() {
			return {
				publicTextColor:'',
				publicimg:'',
				zhuangtai:0,
				page:1,
				size:15,
				moneyList:[]
			};
		},
		onShow() {
			this.getList()
			let that = this
			let aniosgaodu = 0
			uni.getSystemInfo({
				success: function(res) {
					console.log(res);
					that.zhuangtai = res.statusBarHeight;
					var a = res.model.split(' ');
					if (a[0] == 'iPhone') {
						aniosgaodu = 44;
					} else {
						aniosgaodu = 48;
					}
					that.zhuangtai = parseInt(that.zhuangtai)+4
					console.log(that.zhuangtai)
				}
			});
		},
		onLoad() {
			this.setcolorConfig()
		},
		onReachBottom() {
			this.page ++
			this.getList()
		},
		computed:{
			app_border_bottom(){
				return `border-bottom:2rpx solid ${this.publicTextColor.app_border_color};`
			},
			app_bg(){
				return `background:${this.publicTextColor.app_bg_color};`
			},
			font_4th_color(){
				return `color:${this.publicTextColor.font_3rd_color};`
			},
			font_1st(){
				return `color:${this.publicTextColor.font_1st_color};`
			}
		},
		methods:{
			getList(){
				let _self = this
				uni.request({
					url: util.getUrl("member/money"),
					header: {
						'content-type': 'application/x-www-form-urlencoded',
						'Authori-zation':uni.getStorageSync("token")
					},
					data:{
						page:_self.page,
						size:_self.size
					},
					method: 'POST',
					success: res => {
						if(res.data.code == 1){
							if(_self.page == 1){
								_self.moneyList = res.data.data.list
							}else if(res.data.data.length <=0){
								_self.page --
							}else{
								for(let key in res.data.data.list){
									_self.moneyList.push(res.data.data.list[key])
								}
							}
						}
					},
				});
			},
			setcolorConfig(){
				this.publicTextColor = uni.getStorageSync("diyColor")
				this.publicimg = uni.getStorageSync("diyImg")
			},
			backClick(){
				uni.navigateBack({
					
				})
			}
		}
	}
</script>

<style lang="scss">
	.listitem{
		width: 690rpx;
		display: flex;
		flex-direction: column;
		align-items: center;
		box-sizing: border-box;
		padding: 0 30rpx;
		border-radius: 20rpx;
		.item{
			width: 630rpx;
			padding: 30rpx 0;
			box-sizing: border-box;
			display: flex;
			align-items: center;
			justify-content: space-around;
		}
	}
	.listindex{
		box-sizing: border-box;
		height: 80rpx;
		width: 690rpx;
		border-radius: 20rpx;
		display: flex;
		align-items: center;
		justify-content: space-around;
		margin-bottom: 20rpx;
		.item{
			width: 100rpx;
			text-align: right;
		}
	}
	.content{
		min-height: 100vh;
		width: 750rpx;
		display: flex;
		flex-direction: column;
		align-items: center;
		box-sizing: border-box;
		padding-bottom: 30rpx;
	}
	.topTitle{
		color: #FFFFFF;
		display: flex;
		align-items: center;
		height: 67rpx;
		justify-content: center;
		position: absolute;
		z-index: 10;
		width: 100%;
		.back{
			width: 20rpx;
			height: 31rpx;
			position: absolute;
			left: 31rpx;
		}
	}
</style>
